package com.nyt.org.modules.api.handler;

import com.alibaba.fastjson.JSONObject;
import com.nyt.org.common.utils.HttpUtil;
import com.nyt.org.common.utils.SpringContextHolder;
import com.nyt.org.modules.OrderCancel.service.OrderCancelDoService;
import com.nyt.org.modules.api.model.PublicRequest;

import javax.servlet.ServletResponse;
import java.util.Map;

public class OrderCancelHandler {

    private static OrderCancelDoService service = SpringContextHolder.getBean(OrderCancelDoService.class);

    public static Object doMsgHandle(String methodName, ServletResponse response, PublicRequest publicReq, JSONObject body) {

        Map<String,Object> resp = service.orderCancelDo(body);

        Object rspCode = resp.get("rspCode");
        Object rspMsg =resp.get("rspMsg");
        Object responseBean =resp.get("responseBean");

        if(!("0000".equals(rspCode))){
            //失败
            HttpUtil.loseResponse(response, publicReq, rspMsg.toString());
        }
        //成功
        HttpUtil.sucessResponse(response, publicReq, responseBean);
        return null;
    }
}
